package TenoriOn
{
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class Light extends Sprite
	{
		public const STATES:Vector.<uint>=new <uint>[0xB8C7CC,0xF6F6FF,0x33CCFF];
		
		public function Light(i:int,j:int){
			_id=new Point(i,j);
			redraw();
		}
		
		private var _state:int=0;
		
		private var _id:Point;
		public function get id():Point{
			return _id;
		}
		
		public function get state():int{
			return _state;
		}
		public function set state(value:int):void{
			if(value<=2&&value>=0){
				_state=value;
				redraw();
			}
			else
				throw new Error("Invalid value "+value.toString()+" for TenoriOn.Light.state -> valid range=0-2");
		}
		
		public function redraw():void{
			graphics.clear();
			graphics.beginFill(STATES[_state]);
			graphics.drawCircle(0,0,18);
		}
	}
}